var gcToggle = "#ffff00";
var gcBG = "#CCCCFF";

function fPopUpCalendarDlg(ctrlobj)
{
	showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 210 + 4 + 18;

	retval = window.showModalDialog("../CalendarDlg.htm", "", "dialogWidth:210px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
	if( retval != null ){
		ctrlobj.value = retval;
	}else{
		//alert("canceled");
	}
}

function fPopUpTimeDlg(ctrlobj)
{
	showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 210 + 4 + 18;

	retval = window.showModalDialog("../TimeDlg.htm", "", "dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
	if( retval != null ){
		ctrlobj.value = retval;
	}else{
		//alert("canceled");
	}
}

function isNumber(sValue) {
	return isMakeOf(sValue,"+-.0123456789");
}

function FormisNumber(ctrlobj){
	if(isNumber(ctrlobj.value)) 
		return true;
	else {
		alert("please inout digit!");
		return false;
	}
}

function isMakeOf( sValue, sElement ){
	var nIndex = 0;
	sValue = sValue.toUpperCase();
	sElement = sElement.toUpperCase();	
	for (nIndex=0; nIndex<sValue.length; nIndex++)  
    {  
        cCheck = sValue.charAt(nIndex);
        if (sElement.indexOf( cCheck )< 0) {  
			return false;
        }  
    }
	return true;
}

function fPopUpColorDlg(ctrlobj)
{
	showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 380 + 4 + 18;
	retval = window.showModalDialog("../ColorDlg.htm", "", "dialogWidth:242px; dialogHeight:333px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
	if( retval != null ){
		ctrlobj.value = retval;
	}else{
	}
}

function fPopUpChart(dialogType,WINwidth,WINheight, para1,para2)
{
	showx = event.screenX / 3 ; // + deltaX;
	showy = event.screenY / 3 ; // + deltaY;

	var features =
		'dialogWidth:'  + WINwidth  + 'px;' +
		'dialogHeight:' + WINheight + 'px;' +
		'dialogLeft:'   + showx     + 'px;' +
		'dialogTop:'    + showy     + 'px;' +
		'directories:no; localtion:no; menubar:no; status=no; toolbar=no;scrollbars:no;Resizeable=no';

	if(dialogType == "POPUP_VOTECHART"){
		endtarget = "../vote/vote-chart.do?action=Init&serialId=" + para1;
	}
	var retval = window.showModalDialog(endtarget, " ", features );
}


function closewindow()
{
	var top=this;
 	if (parent) top=parent;
 	top.returnValue=null;
 	top.close(); 		
}


function OpenWin(url,formname)
{
		if(formname==null || formname=="")
			formname="ion_small";		
		var newwindow=window.open(url,formname,"menubar=no,toolbar=no,scrollbars=no,width=400,height=250,status=0,left=200,top=100");
		newwindow.focus();
}
